package com.javalong.affairs.base.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import com.javalong.affairs.base.common.ServiceLocator;
import com.javalong.affairs.base.common.UIHandler;
import com.javalong.affairs.base.dialog.ProgressDialog;


/**
 * Created by 杨观回 on 2015/12/29 0029.
 * activity 基类，尽量简洁，
 * 需要另外添加东西的，先继承
 */
public abstract class BaseActivity extends AppCompatActivity {

    private ProgressDialog progressDialog;

    protected UIHandler uiHandler;
    protected ServiceLocator serviceLocator;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        serviceLocator = ServiceLocator.GetInstance();
        uiHandler = serviceLocator.getInstance(UIHandler.class);
    }

    /**
     * 获取进度条dialog
     */
    public ProgressDialog getProgressDialog() {
        if (progressDialog == null) {
            progressDialog = new ProgressDialog(this);
            progressDialog.setCanceledOnTouchOutside(false);
        }
        return progressDialog;
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

}
